package engine.entities;

import java.awt.Rectangle;

public abstract class AbstractEntity implements Entity
{
	protected boolean intersection=false;
	protected double x, y, width, height;
	protected int cur_model=0;
	protected Rectangle hitbox = new Rectangle();
	public AbstractEntity(double x, double y, double width, double height)
	{
		this.x=x;
		this.y=y;
		this.width=width;
		this.height=height;
	}

	@Override
	public void render()
	{
		
	}

	@Override
	public void update(int delta)
	{

	}

	@Override
	public void setLocation(double x, double y)
	{
		this.x=x;
		this.y=y;
	}

	@Override
	public void setX(double x)
	{
		this.x=x;
	}

	@Override
	public void setY(double y)
	{
		this.y=y;
	}

	@Override
	public void setWidth(double width)
	{
		this.width=width;
	}

	@Override
	public void setHeight(double height)
	{
		this.height=height;
	}

	@Override
	public double getX()
	{
		return x;
	}

	@Override
	public double getY()
	{
		return y;
	}

	@Override
	public double getWidth()
	{
		return width;
	}

	@Override
	public double getHeight()
	{
		return height;
	}

	@Override
	public boolean intersects(Entity other)
	{
		hitbox.setBounds((int)x,(int)y,(int)width,(int)height);
		if(hitbox.intersects(other.getX(),other.getY(),other.getWidth(),other.getHeight()))
			intersection=true;
		else
			intersection=false;
		return intersection;
	}

	@Override
	public boolean isIntersected()
	{
		return intersection;
	}
	
	@Override
	public int getCurrentModel()
	{
		return cur_model;
	}
}
